package com.linh.trade.data;

import java.util.Date;

import com.linh.trade.Constants;

public class Point {

	private Date date;

	private double rate;

	private long nano;

	private int id;
	
	private boolean inView;

	public Point(Date date, double rate, long nano, int id) {
		super();
		this.date = date;
		this.rate = rate;
		this.nano = nano;
		this.id = id;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public double getRate() {
		return rate;
	}

	public void setRate(double rate) {
		this.rate = rate;
	}

	public long getNano() {
		return nano;
	}

	public void setNano(long nano) {
		this.nano = nano;
	}
	
	

	public synchronized int getId() {
		return id;
	}

	public synchronized void setId(int id) {
		this.id = id;
	}

	@Override
	public String toString() {
		return "Point[date=" + Constants.DATE_FORMAT.format(date) + ",rate="
				+ rate + ",nano=" + nano + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + id;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Point other = (Point) obj;
		if (id != other.id)
			return false;
		return true;
	}

	public synchronized boolean isInView() {
		return inView;
	}

	public synchronized void setInView(boolean inView) {
		this.inView = inView;
		notifyAll();
	}

	

}
